package com.he.demo.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.metadata.ReadSheet;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;

public class ExcelReader {
    public static void main(String[] args) {
        String name = "d:/a.xlsx";
        EasyExcel.read(name, DemoData.class,new ExcelListener()).sheet().doRead();
        // 写法2
//        InputStream in = new BufferedInputStream(new FileInputStream(name));
//        ExcelReader excelReader = EasyExcel.read(in, DemoData.class, new ExcelListener()).build();
//        ReadSheet readSheet = EasyExcel.readSheet(0).build();
//        excelReader.read(readSheet);
//        // 这里千万别忘记关闭，读的时候会创建临时文件，到时磁盘会崩的
//        excelReader.finish();
    }
}
